/*
 * AbastractOS
 * Copyright (C) 2011 Davide Gessa
 * 
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */
#ifndef ABGUI_HPP
#define ABGUI_HPP

extern "C"
{
	#include <klibc/malloc.h>
	#include <types.h>
	#include <klibc/string.h>
	#include <config.h>
}	
#include <Driver.hpp>
#include "../Vesa/Vesa.hpp"
#include <Managers.hpp>




/** AbGui inkernel gui */
class AbGuiDriver : public Driver
{
	public:
		AbGuiDriver();
		~AbGuiDriver();
		
		bool Probe();
		void mainLoop();
		
		uint64_t Read(uint8_t *data, uint64_t size, uint64_t offset){ return 0; };
		uint64_t Write(uint8_t *data, uint64_t size, uint64_t offset){ return 0; };

		void drawPixel(unsigned x, unsigned y, unsigned cl);
		void drawRect(unsigned x0, unsigned y0, unsigned x1, unsigned y1, unsigned cl, bool fill = true);
		void drawLine(unsigned x0, unsigned y0, unsigned x1, unsigned y1, unsigned cl);
		void drawText(char *data, unsigned x, unsigned y, unsigned cl, unsigned size = 16);
		void drawBuffer(uint32_t *data, unsigned x, unsigned y, unsigned dimx, unsigned dimy);

	private:
		VesaDriver *m_Vesa;		///< Vesa driver
		char *m_RendBuf;		///< Render buffer
		uint32_t m_RendDim;		///< Buffer dimension

	protected:
		void swapBuffer(unsigned x0 = 0, unsigned y0 = 0, unsigned x1 = 0, unsigned y1 = 0);
};


#endif
